 using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyState
{
    protected EnemyStateMachine stateMachine;       //����״̬��
    protected Enemy enemyBase;                      //����״̬ģ��

    protected Rigidbody2D rb;                       //����

    protected Transform player;

    private string animBoolName;                    //������

    protected bool triggerCalled;                   //������

    protected float stateTimer;                     //״̬��ʱ��

    public EnemyState(Enemy _enemyBase, EnemyStateMachine _stateMachine, string _animBoolName)
    {
        this.enemyBase = _enemyBase;
        this.stateMachine = _stateMachine;
        this.animBoolName = _animBoolName;
    }

    public virtual void Update()
    {
        stateTimer -= Time.deltaTime;           //����״̬��ʱ��
    }

    public virtual void Enter()
    {
        rb = enemyBase.rb;                      //��ȡ����
        enemyBase.anim.SetBool(animBoolName, true);         //���ö���
        triggerCalled = false;                  //���ô�����
    }

    public virtual void Exit()
    {
        enemyBase.anim.SetBool(animBoolName, false);        //�رն���

        enemyBase.AssignAnimBoolName(animBoolName);
    }

    public virtual void AnimationFinishTrigger()            //��������������
    {
        triggerCalled = true;
    }
}
